Change in openvpn[master]: Allow DEFAULT in data-ciphers and report both expanded and user set o...
A message that is not in the archive (sent off-list or not yet received): gerrit.1733833084000.Ia1c5209022d3ab4c0dac6438c41891c7d059f812@...2715...
Attention is currently required from: flichtenheld.
Hello flichtenheld,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/828?usp=email
to review the following change.
Change subject: Allow DEFAULT in data-ciphers and report both expanded and user set option
......................................................................
Allow DEFAULT in data-ciphers and report both expanded and user set option
This adds support for parsing DEFAULT in data-ciphers, the idea is that people can modify the default without repeating the default ciphers.
In the past we have seem that people will use data-ciphers BF-CBC or data-ciphers AES-128-CBC when getting the warning that the cipher is not supported by the server. This commit aims to provide a better way for these situation as we still want people to rely on default cipher selection from OpenVPN when possible.
Change-Id: Ia1c5209022d3ab4c0dac6438c41891c7d059f812
---
M Changes.rst
M doc/man-sections/protocol-options.rst
M src/openvpn/multi.c
M src/openvpn/options.c
M src/openvpn/options.h
M src/openvpn/ssl_ncp.c
M src/openvpn/ssl_ncp.h
M tests/unit_tests/openvpn/test_ncp.c
8 files changed, 276 insertions(+), 48 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/28/828/1
Changes.rst +5 -0
@@ -22,6 +22,11 @@ For more details see [lwipovpn on Gihtub](https://github.com/OpenVPN/lwipovpn). +Default ciphers in ``--data-ciphers`` + Ciphers in ``--data-ciphers`` can contain the string DEFAULT that is + replaced by the default ciphers used by OpenVPN, making it easier to + add an allowed cipher without having to spell out the default ciphers. + Deprecated features ------------------- ``secret`` support has been removed by default.
doc/man-sections/protocol-options.rst +6 -0
@@ -178,6 +178,12 @@ Chacha20-Poly1305 if the underlying SSL library (and its configuration) supports it. + Starting with OpenVPN 2.7 the special keyword DEFAULT can be used in the + string and is replaced by the default ciphers. This can be used add + an additional allowed cipher to the allowed ciphers, e.g. + :code:`DEFAULT:AES-192-CBC` to use the default ciphers but also allow + :code:`AES-192-CBC`. + Cipher negotiation is enabled in client-server mode only. I.e. if ``--mode`` is set to `server` (server-side, implied by setting ``--server`` ), or if ``--pull`` is specified (client-side, implied by
src/openvpn/multi.c +5 -4
@@ -1896,14 +1896,15 @@if (strlen (peer_ciphers) >0 ) {msg (M_INFO ,"PUSH: No common cipher between server and client. " -"Server data-ciphers: '%s', client supported ciphers '%s'" , - o->ncp_ciphers, peer_ciphers); +"Server data-ciphers: '%s%s', client supported ciphers '%s'" , + o->ncp_ciphers_conf,ncp_expanded_ciphers (o, &gc), peer_ciphers); }else if (tls_multi->remote_ciphername) {msg (M_INFO ,"PUSH: No common cipher between server and client. " -"Server data-ciphers: '%s', client supports cipher '%s'" , - o->ncp_ciphers, tls_multi->remote_ciphername); +"Server data-ciphers: '%s'%s, client supports cipher '%s'" , + o->ncp_ciphers_conf,ncp_expanded_ciphers (o, &gc), + tls_multi->remote_ciphername); }else {
src/openvpn/options.c +3 -36
@@ -3486,40 +3486,6 @@ } } - -/** -* Checks for availibility of Chacha20-Poly1305 and sets -* the ncp_cipher to either AES-256-GCM:AES-128-GCM or -* AES-256-GCM:AES-128-GCM:CHACHA20-POLY1305. -*/ -static void -options_postprocess_setdefault_ncpciphers (struct options *o) -{ -if (o->ncp_ciphers) - { -/* custom --data-ciphers set, keep list */ -return ; - } - -/* check if crypto library supports chacha */ -bool can_do_chacha =cipher_valid ("CHACHA20-POLY1305" ); - -if (can_do_chacha &&dco_enabled (o)) - { -/* also make sure that dco supports chacha */ - can_do_chacha =tls_item_in_cipher_list ("CHACHA20-POLY1305" ,dco_get_supported_ciphers ()); - } - -if (can_do_chacha) - { - o->ncp_ciphers ="AES-256-GCM:AES-128-GCM:CHACHA20-POLY1305" ; - } -else - { - o->ncp_ciphers ="AES-256-GCM:AES-128-GCM" ; - } -} -static void options_postprocess_cipher (struct options *o) {
@@ -3550,7 +3516,8 @@"defaulted to BF-CBC as fallback when cipher negotiation " "failed in this case. If you need this fallback please add " "'--data-ciphers-fallback BF-CBC' to your configuration " - "and/or add BF-CBC to --data-ciphers."); +"and/or add BF-CBC to --data-ciphers. E.g. " + "--data-ciphers %s:BF-CBC", o->ncp_ciphers_conf); }else if (!o->enable_ncp_fallback && !tls_item_in_cipher_list (o->ciphername, o->ncp_ciphers))
@@ -3558,7 +3525,7 @@msg (M_WARN ,"DEPRECATED OPTION: --cipher set to '%s' but missing in " "--data-ciphers (%s). OpenVPN ignores --cipher for cipher " "negotiations. " , - o->ciphername, o->ncp_ciphers); + o->ciphername, o->ncp_ciphers_conf); } }
src/openvpn/options.h +2 -0
@@ -559,6 +559,8 @@const char *ciphername;bool enable_ncp_fallback;/**< If defined fall back to * ciphername if NCP fails */ +/** The original ncp_ciphers specified by the user in the configuration*/ +const char *ncp_ciphers_conf;const char *ncp_ciphers;const char *authname;const char *engine;
src/openvpn/ssl_ncp.c +108 -7
149 lines not on this page · raw message
src/openvpn/ssl_ncp.h +20 -0
@@ -156,4 +156,24 @@bool check_session_cipher (struct tls_session *session,struct options *options); +/** +* Checks for availability of Chacha20-Poly1305 and sets +* the ncp_cipher to either AES-256-GCM:AES-128-GCM or +* AES-256-GCM:AES-128-GCM:CHACHA20-POLY1305 if not set. +* +* If DEFAULT is in the ncp_cipher string, it will be replaced +* by the default cipher string as defined above. +*/ +void +options_postprocess_setdefault_ncpciphers (struct options *o); + +/** returns the o->ncp_ciphers in brackets, e.g. +* (AES-256-GCM:CHACHA20-POLY1305) if o->ncp_ciphers_conf +* and o->ncp_ciphers differ, otherwise an empty string +* +* The returned string will be allocated in the passed \param gc +* +*/ +const char * +ncp_expanded_ciphers (struct options *o,struct gc_arena *gc);#endif /* ifndef OPENVPN_SSL_NCP_H */
tests/unit_tests/openvpn/test_ncp.c +127 -1
146 lines not on this page · raw message
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/828?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ia1c5209022d3ab4c0dac6438c41891c7d059f812
Gerrit-Change-Number: 828
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange
Attention is currently required from: plaisthos.
flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/828?usp=email )
Change subject: Allow DEFAULT in data-ciphers and report both expanded and user set option
......................................................................
Patch Set 1: Code-Review-1
(6 comments)
Patchset:
PS1:
Some nitpicks
File doc/man-sections/protocol-options.rst:
http://gerrit.openvpn.net/c/openvpn/+/828/comment/5f75330f_045154c7 :
PS1, Line 181: Starting with OpenVPN 2.7 the special keyword DEFAULT can be used in the
Probably makes sense to use ``DEFAULT`` here.
File src/openvpn/multi.c:
http://gerrit.openvpn.net/c/openvpn/+/828/comment/9501c1ac_eab351db :
PS1, Line 1905: "Server data-ciphers: '%s'%s, client supports cipher '%s'",
make consistent with the other case. Either '%s%s' or '%s'%s, but not both.
File src/openvpn/ssl_ncp.h:
http://gerrit.openvpn.net/c/openvpn/+/828/comment/1d04131f_fb1c7b2c :
PS1, Line 174: * The returned string will be allocated in the passed \param gc If you want to format a word as param use \p, \param is for documenting parameters.
File src/openvpn/ssl_ncp.c:
http://gerrit.openvpn.net/c/openvpn/+/828/comment/c25085e2_a57ade0c :
PS1, Line 537: * Replaces the string DEFAULT with the string \param replace. The \p
File tests/unit_tests/openvpn/test_ncp.c:
http://gerrit.openvpn.net/c/openvpn/+/828/comment/87f080cb_fef0e6b6 :
PS1, Line 356: test_ncp_expand(void **state)
I would suggest to add a testcase here where ncp_cipher_conf contains DEFAULT but is not equal to DEFAULT.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/828?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ia1c5209022d3ab4c0dac6438c41891c7d059f812
Gerrit-Change-Number: 828
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Tue, 10 Dec 2024 17:35:16 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: flichtenheld.
plaisthos has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/828?usp=email )
Change subject: Allow DEFAULT in data-ciphers and report both expanded and user set option
......................................................................
Patch Set 1:
(5 comments)
File doc/man-sections/protocol-options.rst:
http://gerrit.openvpn.net/c/openvpn/+/828/comment/51d7502e_31b1c083 :
PS1, Line 181: Starting with OpenVPN 2.7 the special keyword DEFAULT can be used in the
Quoted 1 line
Probably makes sense to use ``DEFAULT`` here.
Done
File src/openvpn/multi.c:
http://gerrit.openvpn.net/c/openvpn/+/828/comment/d1714501_fb5ceee1 :
PS1, Line 1905: "Server data-ciphers: '%s'%s, client supports cipher '%s'",
Quoted 1 line
make consistent with the other case. Either '%s%s' or '%s'%s, but not both.
Done
File src/openvpn/ssl_ncp.h:
http://gerrit.openvpn.net/c/openvpn/+/828/comment/0e004a12_dc41d0f5 :
PS1, Line 174: * The returned string will be allocated in the passed \param gc
Quoted 1 line
If you want to format a word as param use \p, \param is for documenting parameters.
I will use \c since \c and \p are the same according to documentation and seem to use \c rather than \p in OpenVPN 2.x
File src/openvpn/ssl_ncp.c:
http://gerrit.openvpn.net/c/openvpn/+/828/comment/711f6f13_504c6970 :
PS1, Line 537: * Replaces the string DEFAULT with the string \param replace. The
Quoted 1 line
\p
Done
File tests/unit_tests/openvpn/test_ncp.c:
http://gerrit.openvpn.net/c/openvpn/+/828/comment/b36dcfd7_095812e3 :
PS1, Line 356: test_ncp_expand(void **state)
Quoted 1 line
I would suggest to add a testcase here where
ncp_cipher_confcontains DEFAULT but is not equal to DE […]
added
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/828?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ia1c5209022d3ab4c0dac6438c41891c7d059f812
Gerrit-Change-Number: 828
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Thu, 19 Dec 2024 18:05:32 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: flichtenheld <[email protected]...>
Gerrit-MessageType: comment
Attention is currently required from: flichtenheld.
Hello flichtenheld,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/828?usp=email
to look at the new patch set (#2).
The following approvals got outdated and were removed:
Code-Review-1 by flichtenheld
Change subject: Allow DEFAULT in data-ciphers and report both expanded and user set option
......................................................................
Allow DEFAULT in data-ciphers and report both expanded and user set option
This adds support for parsing DEFAULT in data-ciphers, the idea is that people can modify the default without repeating the default ciphers.
In the past we have seem that people will use data-ciphers BF-CBC or data-ciphers AES-128-CBC when getting the warning that the cipher is not supported by the server. This commit aims to provide a better way for these situation as we still want people to rely on default cipher selection from OpenVPN when possible.
---
M Changes.rst
M doc/man-sections/protocol-options.rst
M src/openvpn/multi.c
M src/openvpn/options.c
M src/openvpn/options.h
M src/openvpn/ssl_ncp.c
M src/openvpn/ssl_ncp.h
M tests/unit_tests/openvpn/test_ncp.c
8 files changed, 283 insertions(+), 48 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/28/828/2
Changes.rst +5 -0
@@ -22,6 +22,11 @@ For more details see [lwipovpn on Gihtub](https://github.com/OpenVPN/lwipovpn). +Default ciphers in ``--data-ciphers`` + Ciphers in ``--data-ciphers`` can contain the string DEFAULT that is + replaced by the default ciphers used by OpenVPN, making it easier to + add an allowed cipher without having to spell out the default ciphers. + Deprecated features ------------------- ``secret`` support has been removed by default.
doc/man-sections/protocol-options.rst +6 -0
@@ -178,6 +178,12 @@ Chacha20-Poly1305 if the underlying SSL library (and its configuration) supports it. + Starting with OpenVPN 2.7 the special keyword :code:`DEFAULT` can be used + in the string and is replaced by the default ciphers. This can be used add + an additional allowed cipher to the allowed ciphers, e.g. + :code:`DEFAULT:AES-192-CBC` to use the default ciphers but also allow + :code:`AES-192-CBC`. + Cipher negotiation is enabled in client-server mode only. I.e. if ``--mode`` is set to `server` (server-side, implied by setting ``--server`` ), or if ``--pull`` is specified (client-side, implied by
src/openvpn/multi.c +5 -4
@@ -1896,14 +1896,15 @@if (strlen (peer_ciphers) >0 ) {msg (M_INFO ,"PUSH: No common cipher between server and client. " -"Server data-ciphers: '%s', client supported ciphers '%s'" , - o->ncp_ciphers, peer_ciphers); +"Server data-ciphers: '%s'%s, client supported ciphers '%s'" , + o->ncp_ciphers_conf,ncp_expanded_ciphers (o, &gc), peer_ciphers); }else if (tls_multi->remote_ciphername) {msg (M_INFO ,"PUSH: No common cipher between server and client. " -"Server data-ciphers: '%s', client supports cipher '%s'" , - o->ncp_ciphers, tls_multi->remote_ciphername); +"Server data-ciphers: '%s'%s, client supports cipher '%s'" , + o->ncp_ciphers_conf,ncp_expanded_ciphers (o, &gc), + tls_multi->remote_ciphername); }else {
src/openvpn/options.c +3 -36
@@ -3486,40 +3486,6 @@ } } - -/** -* Checks for availibility of Chacha20-Poly1305 and sets -* the ncp_cipher to either AES-256-GCM:AES-128-GCM or -* AES-256-GCM:AES-128-GCM:CHACHA20-POLY1305. -*/ -static void -options_postprocess_setdefault_ncpciphers (struct options *o) -{ -if (o->ncp_ciphers) - { -/* custom --data-ciphers set, keep list */ -return ; - } - -/* check if crypto library supports chacha */ -bool can_do_chacha =cipher_valid ("CHACHA20-POLY1305" ); - -if (can_do_chacha &&dco_enabled (o)) - { -/* also make sure that dco supports chacha */ - can_do_chacha =tls_item_in_cipher_list ("CHACHA20-POLY1305" ,dco_get_supported_ciphers ()); - } - -if (can_do_chacha) - { - o->ncp_ciphers ="AES-256-GCM:AES-128-GCM:CHACHA20-POLY1305" ; - } -else - { - o->ncp_ciphers ="AES-256-GCM:AES-128-GCM" ; - } -} -static void options_postprocess_cipher (struct options *o) {
@@ -3550,7 +3516,8 @@"defaulted to BF-CBC as fallback when cipher negotiation " "failed in this case. If you need this fallback please add " "'--data-ciphers-fallback BF-CBC' to your configuration " - "and/or add BF-CBC to --data-ciphers."); +"and/or add BF-CBC to --data-ciphers. E.g. " + "--data-ciphers %s:BF-CBC", o->ncp_ciphers_conf); }else if (!o->enable_ncp_fallback && !tls_item_in_cipher_list (o->ciphername, o->ncp_ciphers))
@@ -3558,7 +3525,7 @@msg (M_WARN ,"DEPRECATED OPTION: --cipher set to '%s' but missing in " "--data-ciphers (%s). OpenVPN ignores --cipher for cipher " "negotiations. " , - o->ciphername, o->ncp_ciphers); + o->ciphername, o->ncp_ciphers_conf); } }
src/openvpn/options.h +2 -0
@@ -559,6 +559,8 @@const char *ciphername;bool enable_ncp_fallback;/**< If defined fall back to * ciphername if NCP fails */ +/** The original ncp_ciphers specified by the user in the configuration*/ +const char *ncp_ciphers_conf;const char *ncp_ciphers;const char *authname;const char *engine;
src/openvpn/ssl_ncp.c +109 -7
150 lines not on this page · raw message
src/openvpn/ssl_ncp.h +19 -0
@@ -156,4 +156,23 @@bool check_session_cipher (struct tls_session *session,struct options *options); +/** +* Checks for availability of Chacha20-Poly1305 and sets +* the ncp_cipher to either AES-256-GCM:AES-128-GCM or +* AES-256-GCM:AES-128-GCM:CHACHA20-POLY1305 if not set. +* +* If DEFAULT is in the ncp_cipher string, it will be replaced +* by the default cipher string as defined above. +*/ +void +options_postprocess_setdefault_ncpciphers (struct options *o); + +/** returns the o->ncp_ciphers in brackets, e.g. +* (AES-256-GCM:CHACHA20-POLY1305) if o->ncp_ciphers_conf +* and o->ncp_ciphers differ, otherwise an empty string +* +* The returned string will be allocated in the passed \c gc +*/ +const char * +ncp_expanded_ciphers (struct options *o,struct gc_arena *gc);#endif /* ifndef OPENVPN_SSL_NCP_H */
tests/unit_tests/openvpn/test_ncp.c +134 -1
153 lines not on this page · raw message
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/828?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ia1c5209022d3ab4c0dac6438c41891c7d059f812
Gerrit-Change-Number: 828
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: plaisthos.
flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/828?usp=email )
Change subject: Allow DEFAULT in data-ciphers and report both expanded and user set option
......................................................................
Patch Set 2:
(1 comment)
File doc/man-sections/protocol-options.rst:
http://gerrit.openvpn.net/c/openvpn/+/828/comment/4c40e0f4_68200bc3 :
PS2, Line 182: in the string and is replaced by the default ciphers. This can be used add
"used to add"
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/828?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ia1c5209022d3ab4c0dac6438c41891c7d059f812
Gerrit-Change-Number: 828
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Mon, 23 Dec 2024 17:19:03 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: flichtenheld.
plaisthos has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/828?usp=email )
Change subject: Allow DEFAULT in data-ciphers and report both expanded and user set option
......................................................................
Patch Set 2:
(1 comment)
File doc/man-sections/protocol-options.rst:
http://gerrit.openvpn.net/c/openvpn/+/828/comment/5ea6674a_c7c1e0f3 :
PS2, Line 182: in the string and is replaced by the default ciphers. This can be used add
Quoted 1 line
"used to add"
Acknowledged
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/828?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ia1c5209022d3ab4c0dac6438c41891c7d059f812
Gerrit-Change-Number: 828
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Mon, 23 Dec 2024 19:52:26 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: flichtenheld <[email protected]...>
Gerrit-MessageType: comment
Attention is currently required from: flichtenheld.
Hello flichtenheld,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/828?usp=email
to look at the new patch set (#3).
Change subject: Allow DEFAULT in data-ciphers and report both expanded and user set option
......................................................................
Allow DEFAULT in data-ciphers and report both expanded and user set option
This adds support for parsing DEFAULT in data-ciphers, the idea is that people can modify the default without repeating the default ciphers.
In the past we have seem that people will use data-ciphers BF-CBC or data-ciphers AES-128-CBC when getting the warning that the cipher is not supported by the server. This commit aims to provide a better way for these situation as we still want people to rely on default cipher selection from OpenVPN when possible.
---
M Changes.rst
M doc/man-sections/protocol-options.rst
M src/openvpn/multi.c
M src/openvpn/options.c
M src/openvpn/options.h
M src/openvpn/ssl_ncp.c
M src/openvpn/ssl_ncp.h
M tests/unit_tests/openvpn/test_ncp.c
8 files changed, 284 insertions(+), 48 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/28/828/3
Changes.rst +6 -0
@@ -30,6 +30,12 @@ https://datatracker.ietf.org/doc/draft-irtf-cfrg-aead-limits/ +Default ciphers in ``--data-ciphers`` + Ciphers in ``--data-ciphers`` can contain the string DEFAULT that is + replaced by the default ciphers used by OpenVPN, making it easier to + add an allowed cipher without having to spell out the default ciphers. + + Deprecated features ------------------- ``secret`` support has been removed by default.
doc/man-sections/protocol-options.rst +6 -0
@@ -178,6 +178,12 @@ Chacha20-Poly1305 if the underlying SSL library (and its configuration) supports it. + Starting with OpenVPN 2.7 the special keyword :code:`DEFAULT` can be used + in the string and is replaced by the default ciphers. This can be used to + add an additional allowed cipher to the allowed ciphers, e.g. + :code:`DEFAULT:AES-192-CBC` to use the default ciphers but also allow + :code:`AES-192-CBC`. + Cipher negotiation is enabled in client-server mode only. I.e. if ``--mode`` is set to `server` (server-side, implied by setting ``--server`` ), or if ``--pull`` is specified (client-side, implied by
src/openvpn/multi.c +5 -4
@@ -1896,14 +1896,15 @@if (strlen (peer_ciphers) >0 ) {msg (M_INFO ,"PUSH: No common cipher between server and client. " -"Server data-ciphers: '%s', client supported ciphers '%s'" , - o->ncp_ciphers, peer_ciphers); +"Server data-ciphers: '%s'%s, client supported ciphers '%s'" , + o->ncp_ciphers_conf,ncp_expanded_ciphers (o, &gc), peer_ciphers); }else if (tls_multi->remote_ciphername) {msg (M_INFO ,"PUSH: No common cipher between server and client. " -"Server data-ciphers: '%s', client supports cipher '%s'" , - o->ncp_ciphers, tls_multi->remote_ciphername); +"Server data-ciphers: '%s'%s, client supports cipher '%s'" , + o->ncp_ciphers_conf,ncp_expanded_ciphers (o, &gc), + tls_multi->remote_ciphername); }else {
src/openvpn/options.c +3 -36
@@ -3486,40 +3486,6 @@ } } - -/** -* Checks for availibility of Chacha20-Poly1305 and sets -* the ncp_cipher to either AES-256-GCM:AES-128-GCM or -* AES-256-GCM:AES-128-GCM:CHACHA20-POLY1305. -*/ -static void -options_postprocess_setdefault_ncpciphers (struct options *o) -{ -if (o->ncp_ciphers) - { -/* custom --data-ciphers set, keep list */ -return ; - } - -/* check if crypto library supports chacha */ -bool can_do_chacha =cipher_valid ("CHACHA20-POLY1305" ); - -if (can_do_chacha &&dco_enabled (o)) - { -/* also make sure that dco supports chacha */ - can_do_chacha =tls_item_in_cipher_list ("CHACHA20-POLY1305" ,dco_get_supported_ciphers ()); - } - -if (can_do_chacha) - { - o->ncp_ciphers ="AES-256-GCM:AES-128-GCM:CHACHA20-POLY1305" ; - } -else - { - o->ncp_ciphers ="AES-256-GCM:AES-128-GCM" ; - } -} -static void options_postprocess_cipher (struct options *o) {
@@ -3550,7 +3516,8 @@"defaulted to BF-CBC as fallback when cipher negotiation " "failed in this case. If you need this fallback please add " "'--data-ciphers-fallback BF-CBC' to your configuration " - "and/or add BF-CBC to --data-ciphers."); +"and/or add BF-CBC to --data-ciphers. E.g. " + "--data-ciphers %s:BF-CBC", o->ncp_ciphers_conf); }else if (!o->enable_ncp_fallback && !tls_item_in_cipher_list (o->ciphername, o->ncp_ciphers))
@@ -3558,7 +3525,7 @@msg (M_WARN ,"DEPRECATED OPTION: --cipher set to '%s' but missing in " "--data-ciphers (%s). OpenVPN ignores --cipher for cipher " "negotiations. " , - o->ciphername, o->ncp_ciphers); + o->ciphername, o->ncp_ciphers_conf); } }
src/openvpn/options.h +2 -0
@@ -559,6 +559,8 @@const char *ciphername;bool enable_ncp_fallback;/**< If defined fall back to * ciphername if NCP fails */ +/** The original ncp_ciphers specified by the user in the configuration*/ +const char *ncp_ciphers_conf;const char *ncp_ciphers;const char *authname;const char *engine;
src/openvpn/ssl_ncp.c +109 -7
150 lines not on this page · raw message
src/openvpn/ssl_ncp.h +19 -0
@@ -156,4 +156,23 @@bool check_session_cipher (struct tls_session *session,struct options *options); +/** +* Checks for availability of Chacha20-Poly1305 and sets +* the ncp_cipher to either AES-256-GCM:AES-128-GCM or +* AES-256-GCM:AES-128-GCM:CHACHA20-POLY1305 if not set. +* +* If DEFAULT is in the ncp_cipher string, it will be replaced +* by the default cipher string as defined above. +*/ +void +options_postprocess_setdefault_ncpciphers (struct options *o); + +/** returns the o->ncp_ciphers in brackets, e.g. +* (AES-256-GCM:CHACHA20-POLY1305) if o->ncp_ciphers_conf +* and o->ncp_ciphers differ, otherwise an empty string +* +* The returned string will be allocated in the passed \c gc +*/ +const char * +ncp_expanded_ciphers (struct options *o,struct gc_arena *gc);#endif /* ifndef OPENVPN_SSL_NCP_H */
tests/unit_tests/openvpn/test_ncp.c +134 -1
153 lines not on this page · raw message
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/828?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ia1c5209022d3ab4c0dac6438c41891c7d059f812
Gerrit-Change-Number: 828
Gerrit-PatchSet: 3
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: plaisthos.
flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/828?usp=email )
Change subject: Allow DEFAULT in data-ciphers and report both expanded and user set option
......................................................................
Patch Set 3: Code-Review+2
(1 comment)
Patchset:
PS3:
I have verified most of these changes with t_server_null tests (will try to put some of these in a patch for default test set). I haven't managed to trigger the NCP client-side message.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/828?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ia1c5209022d3ab4c0dac6438c41891c7d059f812
Gerrit-Change-Number: 828
Gerrit-PatchSet: 3
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Fri, 27 Dec 2024 12:19:13 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
PATCH v3 1/1 Allow DEFAULT in data-ciphers and report both expanded and user set option
In reply to a message not in the archiveFrom: Arne Schwabe <[email protected]...>
This adds support for parsing DEFAULT in data-ciphers, the idea is that people can modify the default without repeating the default ciphers.
In the past we have seem that people will use data-ciphers BF-CBC or data-ciphers AES-128-CBC when getting the warning that the cipher is not supported by the server. This commit aims to provide a better way for these situation as we still want people to rely on default cipher selection from OpenVPN when possible.
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/828
This mail reflects revision 3 of this Change.
Acked-by according to Gerrit (reflected above):
Frank Lichtenheld <[email protected]...>
Changes.rst +6 -0
@@ -30,6 +30,12 @@ https://datatracker.ietf.org/doc/draft-irtf-cfrg-aead-limits/ +Default ciphers in ``--data-ciphers`` + Ciphers in ``--data-ciphers`` can contain the string DEFAULT that is + replaced by the default ciphers used by OpenVPN, making it easier to + add an allowed cipher without having to spell out the default ciphers. + + Deprecated features ------------------- ``secret`` support has been removed by default.
doc/man-sections/protocol-options.rst +6 -0
@@ -178,6 +178,12 @@ Chacha20-Poly1305 if the underlying SSL library (and its configuration) supports it. + Starting with OpenVPN 2.7 the special keyword :code:`DEFAULT` can be used + in the string and is replaced by the default ciphers. This can be used to + add an additional allowed cipher to the allowed ciphers, e.g. + :code:`DEFAULT:AES-192-CBC` to use the default ciphers but also allow + :code:`AES-192-CBC`. + Cipher negotiation is enabled in client-server mode only. I.e. if ``--mode`` is set to `server` (server-side, implied by setting ``--server`` ), or if ``--pull`` is specified (client-side, implied by
src/openvpn/multi.c +5 -4
@@ -1896,14 +1896,15 @@if (strlen (peer_ciphers) >0 ) {msg (M_INFO ,"PUSH: No common cipher between server and client. " -"Server data-ciphers: '%s', client supported ciphers '%s'" , - o->ncp_ciphers, peer_ciphers); +"Server data-ciphers: '%s'%s, client supported ciphers '%s'" , + o->ncp_ciphers_conf,ncp_expanded_ciphers (o, &gc), peer_ciphers); }else if (tls_multi->remote_ciphername) {msg (M_INFO ,"PUSH: No common cipher between server and client. " -"Server data-ciphers: '%s', client supports cipher '%s'" , - o->ncp_ciphers, tls_multi->remote_ciphername); +"Server data-ciphers: '%s'%s, client supports cipher '%s'" , + o->ncp_ciphers_conf,ncp_expanded_ciphers (o, &gc), + tls_multi->remote_ciphername); }else {
src/openvpn/options.c +3 -36
@@ -3486,40 +3486,6 @@ } } - -/** -* Checks for availibility of Chacha20-Poly1305 and sets -* the ncp_cipher to either AES-256-GCM:AES-128-GCM or -* AES-256-GCM:AES-128-GCM:CHACHA20-POLY1305. -*/ -static void -options_postprocess_setdefault_ncpciphers (struct options *o) -{ -if (o->ncp_ciphers) - { -/* custom --data-ciphers set, keep list */ -return ; - } - -/* check if crypto library supports chacha */ -bool can_do_chacha =cipher_valid ("CHACHA20-POLY1305" ); - -if (can_do_chacha &&dco_enabled (o)) - { -/* also make sure that dco supports chacha */ - can_do_chacha =tls_item_in_cipher_list ("CHACHA20-POLY1305" ,dco_get_supported_ciphers ()); - } - -if (can_do_chacha) - { - o->ncp_ciphers ="AES-256-GCM:AES-128-GCM:CHACHA20-POLY1305" ; - } -else - { - o->ncp_ciphers ="AES-256-GCM:AES-128-GCM" ; - } -} -static void options_postprocess_cipher (struct options *o) {
@@ -3550,7 +3516,8 @@"defaulted to BF-CBC as fallback when cipher negotiation " "failed in this case. If you need this fallback please add " "'--data-ciphers-fallback BF-CBC' to your configuration " - "and/or add BF-CBC to --data-ciphers."); +"and/or add BF-CBC to --data-ciphers. E.g. " + "--data-ciphers %s:BF-CBC", o->ncp_ciphers_conf); }else if (!o->enable_ncp_fallback && !tls_item_in_cipher_list (o->ciphername, o->ncp_ciphers))
@@ -3558,7 +3525,7 @@msg (M_WARN ,"DEPRECATED OPTION: --cipher set to '%s' but missing in " "--data-ciphers (%s). OpenVPN ignores --cipher for cipher " "negotiations. " , - o->ciphername, o->ncp_ciphers); + o->ciphername, o->ncp_ciphers_conf); } }
src/openvpn/options.h +2 -0
@@ -559,6 +559,8 @@const char *ciphername;bool enable_ncp_fallback;/**< If defined fall back to * ciphername if NCP fails */ +/** The original ncp_ciphers specified by the user in the configuration*/ +const char *ncp_ciphers_conf;const char *ncp_ciphers;const char *authname;const char *engine;
src/openvpn/ssl_ncp.c +109 -7
150 lines not on this page · raw message
src/openvpn/ssl_ncp.h +19 -0
@@ -156,4 +156,23 @@bool check_session_cipher (struct tls_session *session,struct options *options); +/** +* Checks for availability of Chacha20-Poly1305 and sets +* the ncp_cipher to either AES-256-GCM:AES-128-GCM or +* AES-256-GCM:AES-128-GCM:CHACHA20-POLY1305 if not set. +* +* If DEFAULT is in the ncp_cipher string, it will be replaced +* by the default cipher string as defined above. +*/ +void +options_postprocess_setdefault_ncpciphers (struct options *o); + +/** returns the o->ncp_ciphers in brackets, e.g. +* (AES-256-GCM:CHACHA20-POLY1305) if o->ncp_ciphers_conf +* and o->ncp_ciphers differ, otherwise an empty string +* +* The returned string will be allocated in the passed \c gc +*/ +const char * +ncp_expanded_ciphers (struct options *o,struct gc_arena *gc);#endif /* ifndef OPENVPN_SSL_NCP_H */
tests/unit_tests/openvpn/test_ncp.c +134 -1
153 lines not on this page · raw message
[Openvpn-devel] [PATCH applied] Re: Allow DEFAULT in data-ciphers and report both expanded and user set option
I have only lightly reviewed this, and it all seems to make sense.
The idea is good, as we have seen in all these bug reports for 2.6 related to --data-ciphers. The test rig is happy. Also, unit tests ;-)
Your patch has been applied to the master branch.
commit 6a7931a4a89cb35be7b799942e7fa03fde2cdc63
Author: Arne Schwabe Date: Fri Dec 27 13:46:32 2024 +0100
Allow DEFAULT in data-ciphers and report both expanded and user set option
Signed-off-by: Arne Schwabe <[email protected]...>
Acked-by: Frank Lichtenheld <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg30245.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has uploaded a new patch set (#4) to the change originally created by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/828?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by flichtenheld
Change subject: Allow DEFAULT in data-ciphers and report both expanded and user set option
......................................................................
Allow DEFAULT in data-ciphers and report both expanded and user set option
This adds support for parsing DEFAULT in data-ciphers, the idea is that people can modify the default without repeating the default ciphers.
In the past we have seem that people will use data-ciphers BF-CBC or data-ciphers AES-128-CBC when getting the warning that the cipher is not supported by the server. This commit aims to provide a better way for these situation as we still want people to rely on default cipher selection from OpenVPN when possible.
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg30245.html
---
M Changes.rst
M doc/man-sections/protocol-options.rst
M src/openvpn/multi.c
M src/openvpn/options.c
M src/openvpn/options.h
M src/openvpn/ssl_ncp.c
M src/openvpn/ssl_ncp.h
M tests/unit_tests/openvpn/test_ncp.c
8 files changed, 284 insertions(+), 48 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/28/828/4
Changes.rst +6 -0
@@ -30,6 +30,12 @@ https://datatracker.ietf.org/doc/draft-irtf-cfrg-aead-limits/ +Default ciphers in ``--data-ciphers`` + Ciphers in ``--data-ciphers`` can contain the string DEFAULT that is + replaced by the default ciphers used by OpenVPN, making it easier to + add an allowed cipher without having to spell out the default ciphers. + + Deprecated features ------------------- ``secret`` support has been removed by default.
doc/man-sections/protocol-options.rst +6 -0
@@ -178,6 +178,12 @@ Chacha20-Poly1305 if the underlying SSL library (and its configuration) supports it. + Starting with OpenVPN 2.7 the special keyword :code:`DEFAULT` can be used + in the string and is replaced by the default ciphers. This can be used to + add an additional allowed cipher to the allowed ciphers, e.g. + :code:`DEFAULT:AES-192-CBC` to use the default ciphers but also allow + :code:`AES-192-CBC`. + Cipher negotiation is enabled in client-server mode only. I.e. if ``--mode`` is set to `server` (server-side, implied by setting ``--server`` ), or if ``--pull`` is specified (client-side, implied by
src/openvpn/multi.c +5 -4
@@ -1897,14 +1897,15 @@if (strlen (peer_ciphers) >0 ) {msg (M_INFO ,"PUSH: No common cipher between server and client. " -"Server data-ciphers: '%s', client supported ciphers '%s'" , - o->ncp_ciphers, peer_ciphers); +"Server data-ciphers: '%s'%s, client supported ciphers '%s'" , + o->ncp_ciphers_conf,ncp_expanded_ciphers (o, &gc), peer_ciphers); }else if (tls_multi->remote_ciphername) {msg (M_INFO ,"PUSH: No common cipher between server and client. " -"Server data-ciphers: '%s', client supports cipher '%s'" , - o->ncp_ciphers, tls_multi->remote_ciphername); +"Server data-ciphers: '%s'%s, client supports cipher '%s'" , + o->ncp_ciphers_conf,ncp_expanded_ciphers (o, &gc), + tls_multi->remote_ciphername); }else {
src/openvpn/options.c +3 -36
@@ -3486,40 +3486,6 @@ } } - -/** -* Checks for availibility of Chacha20-Poly1305 and sets -* the ncp_cipher to either AES-256-GCM:AES-128-GCM or -* AES-256-GCM:AES-128-GCM:CHACHA20-POLY1305. -*/ -static void -options_postprocess_setdefault_ncpciphers (struct options *o) -{ -if (o->ncp_ciphers) - { -/* custom --data-ciphers set, keep list */ -return ; - } - -/* check if crypto library supports chacha */ -bool can_do_chacha =cipher_valid ("CHACHA20-POLY1305" ); - -if (can_do_chacha &&dco_enabled (o)) - { -/* also make sure that dco supports chacha */ - can_do_chacha =tls_item_in_cipher_list ("CHACHA20-POLY1305" ,dco_get_supported_ciphers ()); - } - -if (can_do_chacha) - { - o->ncp_ciphers ="AES-256-GCM:AES-128-GCM:CHACHA20-POLY1305" ; - } -else - { - o->ncp_ciphers ="AES-256-GCM:AES-128-GCM" ; - } -} -static void options_postprocess_cipher (struct options *o) {
@@ -3550,7 +3516,8 @@"defaulted to BF-CBC as fallback when cipher negotiation " "failed in this case. If you need this fallback please add " "'--data-ciphers-fallback BF-CBC' to your configuration " - "and/or add BF-CBC to --data-ciphers."); +"and/or add BF-CBC to --data-ciphers. E.g. " + "--data-ciphers %s:BF-CBC", o->ncp_ciphers_conf); }else if (!o->enable_ncp_fallback && !tls_item_in_cipher_list (o->ciphername, o->ncp_ciphers))
@@ -3558,7 +3525,7 @@msg (M_WARN ,"DEPRECATED OPTION: --cipher set to '%s' but missing in " "--data-ciphers (%s). OpenVPN ignores --cipher for cipher " "negotiations. " , - o->ciphername, o->ncp_ciphers); + o->ciphername, o->ncp_ciphers_conf); } }
src/openvpn/options.h +2 -0
@@ -559,6 +559,8 @@const char *ciphername;bool enable_ncp_fallback;/**< If defined fall back to * ciphername if NCP fails */ +/** The original ncp_ciphers specified by the user in the configuration*/ +const char *ncp_ciphers_conf;const char *ncp_ciphers;const char *authname;const char *engine;
src/openvpn/ssl_ncp.c +109 -7
150 lines not on this page · raw message
src/openvpn/ssl_ncp.h +19 -0
@@ -157,4 +157,23 @@bool check_session_cipher (struct tls_session *session,struct options *options); +/** +* Checks for availability of Chacha20-Poly1305 and sets +* the ncp_cipher to either AES-256-GCM:AES-128-GCM or +* AES-256-GCM:AES-128-GCM:CHACHA20-POLY1305 if not set. +* +* If DEFAULT is in the ncp_cipher string, it will be replaced +* by the default cipher string as defined above. +*/ +void +options_postprocess_setdefault_ncpciphers (struct options *o); + +/** returns the o->ncp_ciphers in brackets, e.g. +* (AES-256-GCM:CHACHA20-POLY1305) if o->ncp_ciphers_conf +* and o->ncp_ciphers differ, otherwise an empty string +* +* The returned string will be allocated in the passed \c gc +*/ +const char * +ncp_expanded_ciphers (struct options *o,struct gc_arena *gc);#endif /* ifndef OPENVPN_SSL_NCP_H */
tests/unit_tests/openvpn/test_ncp.c +134 -1
153 lines not on this page · raw message
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/828?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ia1c5209022d3ab4c0dac6438c41891c7d059f812
Gerrit-Change-Number: 828
Gerrit-PatchSet: 4
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/828?usp=email )
Change subject: Allow DEFAULT in data-ciphers and report both expanded and user set option
......................................................................
Allow DEFAULT in data-ciphers and report both expanded and user set option
This adds support for parsing DEFAULT in data-ciphers, the idea is that people can modify the default without repeating the default ciphers.
In the past we have seem that people will use data-ciphers BF-CBC or data-ciphers AES-128-CBC when getting the warning that the cipher is not supported by the server. This commit aims to provide a better way for these situation as we still want people to rely on default cipher selection from OpenVPN when possible.
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg30245.html
---
M Changes.rst
M doc/man-sections/protocol-options.rst
M src/openvpn/multi.c
M src/openvpn/options.c
M src/openvpn/options.h
M src/openvpn/ssl_ncp.c
M src/openvpn/ssl_ncp.h
M tests/unit_tests/openvpn/test_ncp.c
8 files changed, 284 insertions(+), 48 deletions(-)
Changes.rst +6 -0
@@ -30,6 +30,12 @@ https://datatracker.ietf.org/doc/draft-irtf-cfrg-aead-limits/ +Default ciphers in ``--data-ciphers`` + Ciphers in ``--data-ciphers`` can contain the string DEFAULT that is + replaced by the default ciphers used by OpenVPN, making it easier to + add an allowed cipher without having to spell out the default ciphers. + + Deprecated features ------------------- ``secret`` support has been removed by default.
doc/man-sections/protocol-options.rst +6 -0
@@ -178,6 +178,12 @@ Chacha20-Poly1305 if the underlying SSL library (and its configuration) supports it. + Starting with OpenVPN 2.7 the special keyword :code:`DEFAULT` can be used + in the string and is replaced by the default ciphers. This can be used to + add an additional allowed cipher to the allowed ciphers, e.g. + :code:`DEFAULT:AES-192-CBC` to use the default ciphers but also allow + :code:`AES-192-CBC`. + Cipher negotiation is enabled in client-server mode only. I.e. if ``--mode`` is set to `server` (server-side, implied by setting ``--server`` ), or if ``--pull`` is specified (client-side, implied by
src/openvpn/multi.c +5 -4
@@ -1897,14 +1897,15 @@if (strlen (peer_ciphers) >0 ) {msg (M_INFO ,"PUSH: No common cipher between server and client. " -"Server data-ciphers: '%s', client supported ciphers '%s'" , - o->ncp_ciphers, peer_ciphers); +"Server data-ciphers: '%s'%s, client supported ciphers '%s'" , + o->ncp_ciphers_conf,ncp_expanded_ciphers (o, &gc), peer_ciphers); }else if (tls_multi->remote_ciphername) {msg (M_INFO ,"PUSH: No common cipher between server and client. " -"Server data-ciphers: '%s', client supports cipher '%s'" , - o->ncp_ciphers, tls_multi->remote_ciphername); +"Server data-ciphers: '%s'%s, client supports cipher '%s'" , + o->ncp_ciphers_conf,ncp_expanded_ciphers (o, &gc), + tls_multi->remote_ciphername); }else {
src/openvpn/options.c +3 -36
@@ -3486,40 +3486,6 @@ } } - -/** -* Checks for availibility of Chacha20-Poly1305 and sets -* the ncp_cipher to either AES-256-GCM:AES-128-GCM or -* AES-256-GCM:AES-128-GCM:CHACHA20-POLY1305. -*/ -static void -options_postprocess_setdefault_ncpciphers (struct options *o) -{ -if (o->ncp_ciphers) - { -/* custom --data-ciphers set, keep list */ -return ; - } - -/* check if crypto library supports chacha */ -bool can_do_chacha =cipher_valid ("CHACHA20-POLY1305" ); - -if (can_do_chacha &&dco_enabled (o)) - { -/* also make sure that dco supports chacha */ - can_do_chacha =tls_item_in_cipher_list ("CHACHA20-POLY1305" ,dco_get_supported_ciphers ()); - } - -if (can_do_chacha) - { - o->ncp_ciphers ="AES-256-GCM:AES-128-GCM:CHACHA20-POLY1305" ; - } -else - { - o->ncp_ciphers ="AES-256-GCM:AES-128-GCM" ; - } -} -static void options_postprocess_cipher (struct options *o) {
@@ -3550,7 +3516,8 @@"defaulted to BF-CBC as fallback when cipher negotiation " "failed in this case. If you need this fallback please add " "'--data-ciphers-fallback BF-CBC' to your configuration " - "and/or add BF-CBC to --data-ciphers."); +"and/or add BF-CBC to --data-ciphers. E.g. " + "--data-ciphers %s:BF-CBC", o->ncp_ciphers_conf); }else if (!o->enable_ncp_fallback && !tls_item_in_cipher_list (o->ciphername, o->ncp_ciphers))
@@ -3558,7 +3525,7 @@msg (M_WARN ,"DEPRECATED OPTION: --cipher set to '%s' but missing in " "--data-ciphers (%s). OpenVPN ignores --cipher for cipher " "negotiations. " , - o->ciphername, o->ncp_ciphers); + o->ciphername, o->ncp_ciphers_conf); } }
src/openvpn/options.h +2 -0
@@ -559,6 +559,8 @@const char *ciphername;bool enable_ncp_fallback;/**< If defined fall back to * ciphername if NCP fails */ +/** The original ncp_ciphers specified by the user in the configuration*/ +const char *ncp_ciphers_conf;const char *ncp_ciphers;const char *authname;const char *engine;
src/openvpn/ssl_ncp.c +109 -7
150 lines not on this page · raw message
src/openvpn/ssl_ncp.h +19 -0
@@ -157,4 +157,23 @@bool check_session_cipher (struct tls_session *session,struct options *options); +/** +* Checks for availability of Chacha20-Poly1305 and sets +* the ncp_cipher to either AES-256-GCM:AES-128-GCM or +* AES-256-GCM:AES-128-GCM:CHACHA20-POLY1305 if not set. +* +* If DEFAULT is in the ncp_cipher string, it will be replaced +* by the default cipher string as defined above. +*/ +void +options_postprocess_setdefault_ncpciphers (struct options *o); + +/** returns the o->ncp_ciphers in brackets, e.g. +* (AES-256-GCM:CHACHA20-POLY1305) if o->ncp_ciphers_conf +* and o->ncp_ciphers differ, otherwise an empty string +* +* The returned string will be allocated in the passed \c gc +*/ +const char * +ncp_expanded_ciphers (struct options *o,struct gc_arena *gc);#endif /* ifndef OPENVPN_SSL_NCP_H */
tests/unit_tests/openvpn/test_ncp.c +134 -1
153 lines not on this page · raw message
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/828?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ia1c5209022d3ab4c0dac6438c41891c7d059f812
Gerrit-Change-Number: 828
Gerrit-PatchSet: 4
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged